import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsEmpty } from 'class-validator';
import { DeviceMetaModelV1 } from '../models/device-meta.model';

/**
 * Device metadata request DTO
 * Contains information about the device hardware and software
 * Used for incoming API requests
 */
export class DeviceMetaRequestDto extends DeviceMetaModelV1 {
  // Explicitly reject version property if provided by client
  @IsEmpty({ message: 'Version property cannot be set by client' })
  version?: string;
}

/**
 * Device metadata response DTO
 * Contains information about the device hardware and software with version
 * Used for API responses
 */
export class DeviceMetaResponseDto extends DeviceMetaModelV1 {
  @ApiProperty({
    description: 'Metadata schema version to help with decoding',
    example: '1',
    required: true,
  })
  @IsString()
  version: string = '1';
}

/**
 * For backward compatibility and simpler usage
 */
export class DeviceMetaDto extends DeviceMetaResponseDto {}
